package com.itheima.a07regexdemo1;

public class RegexDemo2 {
    public static void main(String[] args) {
        //严格校验身份证号
        //ctrl+alt+m:抽取方法
        extracted();
    }

    private static void extracted() {
        //123456 12 34 12 34 1234
        //开头一位不能是0 后面5位任意
        //年份18 19 20
        //月份01~09|10~12 日期0~31
        //后面4位 前三位随意 最后一位时任意数字或者Xx
        String regex="[1-9]\\d{5}(1[89]|2[0])\\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])\\d{3}[\\dXx]";
        System.out.println("36243020001230213x".matches(regex));
        System.out.println("06243020001230213x".matches(regex));
        System.out.println("36243020001230213X".matches(regex));
        System.out.println("36243020001232213x".matches(regex));
        System.out.println("36243018001230213x".matches(regex));
        System.out.println("36243020001330213x".matches(regex));
    }
}
